import { RouteRecordRaw } from "vue-router";
const routes: Array<RouteRecordRaw> = [
	{
		path: "/",
		redirect: "/dashboard",
	},
	{
		path: "/login",
		name: "Login",
		meta: {
			requiresAuth: false,
			title: "登录",
			keepAlive: false,
		},
		component: () => import("@/views/other/login.vue"),
	},
	{
		path: "/",
		name: "Home",
		component: () => import("@/layout/index.vue"),
		children: [
			{
				path: "dashboard",
				name: "Dashboard",
				meta: {
					requiresAuth: true,
					title: "首页",
					keepAlive: false,
				},
				component: () => import("@/views/other/dashboard.vue"),
				children: [],
			},
			{
				path: "personCenter",
				name: "PersonCenter",
				meta: {
					requiresAuth: true,
					title: "个人中心",
					keepAlive: false,
				},
				component: () => import("@/views/other/person-center.vue"),
				children: [],
			},
			{
				path: "icons",
				name: "IconsPage",
				meta: {
					requiresAuth: true,
					title: "图标",
					keepAlive: false,
				},
				component: () => import("@/views/other/icons.vue"),
				children: [],
			},
			{
				path: "permissions",
				name: "PermissionsPage",
				meta: {
					requiresAuth: true,
					title: "权限测试页",
					keepAlive: false,
				},
				component: () => import("@/views/other/permissions-page.vue"),
				children: [],
			},
			{
				path: "clipboard",
				name: "Clipboard",
				meta: {
					requiresAuth: true,
					title: "Clipboard",
					keepAlive: false,
				},
				component: () => import("@/views/other/clipboard.vue"),
				children: [],
			},
			{
				path: "exportFile",
				name: "ExportFile",
				meta: {
					requiresAuth: true,
					title: "导出 File",
					keepAlive: false,
				},
				component: () => import("@/views/other/export-file.vue"),
				children: [],
			},
			{
				path: "message",
				name: "Message",
				meta: {
					requiresAuth: true,
					title: "消息中心",
					keepAlive: false,
				},
				component: () => import("@/views/other/message.vue"),
				children: [],
			},
		],
	},
	{
		path: "/components",
		name: "Components",
		meta: {
			requiresAuth: true,
			title: "组件",
			keepAlive: false,
		},
		redirect: "/components/tinymce",
		component: () => import("@/layout/index.vue"),
		children: [
			{
				path: "tinymce",
				name: "TinymcePage",
				meta: {
					requiresAuth: true,
					title: "富文本编辑器",
					keepAlive: true,
				},
				component: () => import("@/views/components/tinymce-page.vue"),
				children: [],
			},
			{
				path: "jsoneditor",
				name: "JsonEditorPage",
				meta: {
					requiresAuth: true,
					title: "JSON 编辑器",
					keepAlive: true,
				},
				component: () => import("@/views/components/jsoneditor-page.vue"),
				children: [],
			},
			{
				path: "charts",
				name: "Charts",
				meta: {
					requiresAuth: true,
					title: "图表",
					keepAlive: false,
				},
				component: () => import("@/views/components/charts.vue"),
				children: [],
			},
		],
	},
	{
		path: "/nested-routing",
		name: "NestedRouting",
		meta: {
			requiresAuth: true,
			title: "路由嵌套",
			keepAlive: false,
		},
		redirect: "/nested-routing/menu-one",
		component: () => import("@/layout/index.vue"),
		children: [
			{
				path: "menu-one",
				name: "MenuOne",
				meta: {
					requiresAuth: true,
					title: "菜单-1",
					keepAlive: false,
				},
				redirect: "/nested-routing/menu-one/menu-one-one",
				component: () => import("@/components/MyRouterView.vue"),
				children: [
					{
						path: "menu-one-one",
						name: "MenuOneOne",
						meta: {
							requiresAuth: true,
							title: "菜单-1-1",
							keepAlive: false,
						},
						component: () => import("@/views/nested-routing/menu-one/menu-one-one.vue"),
						children: [],
					},
					{
						path: "menu-one-two",
						name: "MenuOneTwo",
						meta: {
							requiresAuth: true,
							title: "菜单-1-2",
							keepAlive: false,
						},
						component: () => import("@/views/nested-routing/menu-one/menu-one-two.vue"),
						children: [],
					},
					{
						path: "menu-one-three",
						name: "MenuOneThree",
						meta: {
							requiresAuth: true,
							title: "菜单-1-3",
							keepAlive: false,
						},
						component: () =>
							import("@/views/nested-routing/menu-one/menu-one-three.vue"),
						children: [],
					},
				],
			},
			{
				path: "menu-two",
				name: "MenuTwo",
				meta: {
					requiresAuth: true,
					title: "菜单-2",
					keepAlive: false,
				},
				component: () => import("@/views/nested-routing/menu-two.vue"),
				children: [],
			},
		],
	},
	{
		path: "/setting",
		name: "Setting",
		meta: {
			requiresAuth: true,
			title: "设置",
			keepAlive: false,
		},
		redirect: "/setting/system",
		component: () => import("@/layout/index.vue"),
		children: [
			{
				path: "system",
				name: "System",
				meta: {
					requiresAuth: true,
					title: "系统设置",
					keepAlive: false,
				},
				component: () => import("@/views/system/system.vue"),
				children: [],
			},
			{
				path: "menu",
				name: "MenuPage",
				meta: {
					requiresAuth: true,
					title: "菜单管理",
					keepAlive: false,
				},
				component: () => import("@/views/system/menu.vue"),
				children: [],
			},
			{
				path: "user",
				name: "User",
				meta: {
					requiresAuth: true,
					title: "用户管理",
					keepAlive: false,
				},
				component: () => import("@/views/system/user.vue"),
				children: [],
			},
		],
	},
	{
		path: "/error",
		name: "Error",
		meta: {
			requiresAuth: true,
			title: "错误页面",
			keepAlive: false,
		},
		redirect: "/error/notFound",
		component: () => import("@/layout/index.vue"),
		children: [
			{
				path: "notFound",
				name: "NotFound",
				meta: {
					requiresAuth: true,
					title: "404",
					keepAlive: false,
				},
				component: () => import("@/views/error/404.vue"),
				children: [],
			},
			{
				path: "notPermission",
				name: "NotPermission",
				meta: {
					requiresAuth: true,
					title: "401",
					keepAlive: false,
				},
				component: () => import("@/views/error/401.vue"),
				children: [],
			},
		],
	},
	{
		path: "/redirect",
		name: "RedirectLayout",
		meta: {
			requiresAuth: true,
			title: "Redirect",
			keepAlive: false,
		},
		redirect: "/redirect",
		component: () => import("@/layout/index.vue"),
		children: [
			{
				path: "",
				name: "Redirect",
				meta: {
					requiresAuth: true,
					title: "Redirect",
					keepAlive: false,
				},
				component: () => import("@/views/other/redirect.vue"),
				children: [],
			},
		],
	},
	{
		path: "/:pathMatch(.*)*",
		name: "FourZeroFour",
		redirect: "/error/notFound",
		meta: {
			requiresAuth: false,
			title: "404",
			keepAlive: false,
		},
	},
];
export default routes;
